]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Add source policy setter
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 2 Mar 2019 19:53:33 +0000 (20:53 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Sun, 3 Mar 2019 08:58:56 +0000 (08:58 +0000)
Commit 8f15193b4 changed the `policy` property from a regular JS property to
a getter. This was necessary to avoid calling an overridden _createPolicy()
method before a subclass is properly initialized, but it broke the second
way of using notification sources:

Don't create a Source subclass, but use the base class directly and change
its `policy` property.

There's no good reason why we should no longer allow this, so add a setter.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/431

js/ui/messageTray.js

index dcba4788ffeb6b356bd033b2bee676790331e7e3..8f81304510adfd741e39e18caf49ad0b30af6cb4 100644 (file)
@@ -708,6 +708,12 @@ var Source = class Source {
         return this._policy;
     }
 
+    set policy(policy) {
+        if (this._policy)
+            this._policy.destroy();
+        this._policy = policy;
+    }
+
     get count() {
         return this.notifications.length;
     }